]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ScreenShield: Fix updating visibility of the notification box
authorGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 16 Aug 2012 20:38:22 +0000 (22:38 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 16 Aug 2012 21:18:02 +0000 (23:18 +0200)
If there were no persistent or resident notification sources,
nothing ever would call _updateVisibility, and the box would stay
there empty

https://bugzilla.gnome.org/show_bug.cgi?id=681143

js/ui/screenShield.js

index 31355a6f7dcea959d1a514265e81cd4e5dc1ed74..5e294c210fab429647473c5c31cab8f7914f6089 100644 (file)
@@ -93,8 +93,9 @@ const NotificationsBox = new Lang.Class({
 
         this._items = [];
         Main.messageTray.getSummaryItems().forEach(Lang.bind(this, function(item) {
-            this._summaryItemAdded(Main.messageTray, item);
+            this._summaryItemAdded(Main.messageTray, item, true);
         }));
+        this._updateVisibility();
 
         this._summaryAddedId = Main.messageTray.connect('summary-item-added', Lang.bind(this, this._summaryItemAdded));
     },
@@ -118,7 +119,7 @@ const NotificationsBox = new Lang.Class({
             return;
         }
 
-        let children = this._persistentNotificationBox.get_children()
+        let children = this._persistentNotificationBox.get_children();
         this.actor.visible = children.some(function(a) { return a.visible; });
     },
 
@@ -157,7 +158,7 @@ const NotificationsBox = new Lang.Class({
         return [box, countLabel];
     },
 
-    _summaryItemAdded: function(tray, item) {
+    _summaryItemAdded: function(tray, item, dontUpdateVisibility) {
         // Ignore transient sources
         if (item.source.isTransient)
             return;
@@ -186,7 +187,8 @@ const NotificationsBox = new Lang.Class({
         obj.sourceDestroyId = item.source.connect('destroy', Lang.bind(this, this._onSourceDestroy));
         this._items.push(obj);
 
-        this._updateVisibility();
+        if (!dontUpdateVisibility)
+            this._updateVisibility();
     },
 
     _findSource: function(source) {